<?php
$isReloadable = true;
require_once("../../../config.inc.php");
require_once(SERVER_FS_ROOT."/app/_inc/include.php");
require_once(SERVER_FS_ROOT."/app/util/imex/_inc/importExport.func.php");

$errMsg = sxREQ('msg');

$objUser = $_SESSION[USEROBJ];
$aDataArea = $objUser->getDataArea();
$fileName = sxREQ('nf');
$aExpTab = array();
$serExpTab = file_get_contents(SERVER_FS_TEMP."/imex/$fileName.txt", "rb");
if($serExpTab === false) {
	$aExpTab = array('error' => array("Unable to create file %s",SERVER_FS_TEMP."/imex/$fileName.txt"=>''));
} else {
	$aExpTab = unserialize(substr($serExpTab,128));
}

//output HTML
$aOpz = array("kMenu"=>'uti.cif', "isReloadable"=>$isReloadable);
echo(headerHTML($aOpz));
echo(bodyHTML($aOpz));
echo("<table width=\"100%\" cellpadding=\"03\" cellspacing=\"0\">\n<tr>\n<td>\n");
//output commands
$aCmd = array(
	"download"=>array("pag"=>"javascript:document.location.href='download.php?nf=$fileName&xsn=".XSN."';",
						"title"=>_t("download"),
						"text"=>_t("download")
						),
	"back"=>array()
	);
$sCmd = (commandsHTML($aCmd));	
echo $sCmd;	
echo("<table class=\"tabl01\" width=\"100%\" cellpadding=\"3\" cellspacing=\"2\" border='0'>\n");
echo("<tr>" .
			"<td class=\"titl01\" colspan ='2'>Exported items</td>" .
		"</tr>\n");
		echo("<tr>" .
			"<td class=\"tabh01\" width='10%'>Item</td>" .
			"<td class=\"tabh01\" width='90%'>Key</td>" .
			"</tr>\n");
foreach($aExpTab as $tabRef => $aTabRef) {
	foreach($aTabRef as $keyRef => $aX) {
		echo("<tr>" .
			"<td class=\"text01\">$tabRef </td>" .
			"<td class=\"text01\">".str_replace('@',' / ',$keyRef)."</td>" .
			"</tr>\n");
	}
}
echo("</table>");
echo $sCmd;	
echo("</form>");
echo("</td>\n</tr>\n</table>\n");
echo(footerHTML());
exit();